<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDriverFinancialTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('driver_financial', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('company_id')->index()->comment('公司ID');
            $table->bigInteger('driver_id')->comment('司机ID');
            $table->integer('service_id')->comment('业务类型ID');
            $table->char('order_sn', 19)->comment('订单号');
            $table->char('financial_sn', 20)->comment('流水号');
            $table->decimal('money', 10, 2)->default(0)->comment('金额');
            $table->bigInteger('user_id')->comment('客户ID');
            $table->bigInteger('car_id')->comment('车辆ID');
            $table->string('start_place')->comment('起始点');
            $table->string('destination')->comment('目的地');
            $table->timestamps();
        });

        \DB::statement("ALTER TABLE `driver_financial` comment '司机流水'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('driver_financial');
    }
}
